package com.yt.dor.service;

import com.yt.dor.models.vo.DormBedVO;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.BeanUtils;
import javax.annotation.Resource;
import com.yt.dor.common.config.YmlConfig;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yt.dor.mapper.DormBedMapper;
import com.yt.dor.models.service.IDormBedService;
import com.yt.dor.models.bo.DormBedSaveBO;
import com.yt.dor.models.dto.DormBedDTO;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * 宿舍床位表详情控制器
 *
 * @author thekai
 * @Date 2025-10-21 14:11:59
 */
@DubboService
public class DormBedServiceImpl extends ServiceImpl<DormBedMapper, DormBedDTO> implements IDormBedService{

    @Resource
    private YmlConfig ymlConfig;
    @Autowired
    private DormBedMapper dormBedMapper;

    @Override
    public boolean add(DormBedSaveBO saveBO) {
        DormBedDTO dto = new DormBedDTO();
        BeanUtils.copyProperties(saveBO,dto);
        Long id = ymlConfig.getPkId();
        dto.setId(id);
        return this.insert(dto);
    }
    @Override
    public List<DormBedVO> query() {
        List<DormBedVO> domnBedV0s = dormBedMapper.query();
        return domnBedV0s;
    }

}
